/**
 * @author LKQ
 * @date 2022/2/26 14:53
 * @description
 */
public class Solution {
    public static void main(String[] args) {
        Solution solution = new Solution();
        solution.countTriples(10);
    }
    public int countTriples(int n) {
        int ans = 0;
        for (int a = 1; a <= n; a++) {
            for (int b = 1; b <= n; b++) {
                int c = (int) Math.sqrt(a * a + b * b + 1.0);
                if(c <= n && c * c == a * a + b * b) {
                    ans++;
                }
            }
        }
        return ans;
    }
}
